package net.seehealth.healthpad.application.adapter;

import java.util.ArrayList;
import java.util.List;

import net.seehealth.healthpad.ui.view.MedicalReportTimeView;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

/**
 * 
 * @className MedicalReportAdapter
 * @author wuhongjie
 * @description 体检报告时间对比项适配器
 * @date 2012-4-13 下午7:53:48
 */
public class MedicalReportTimeAdapter extends BaseAdapter {
	
	/** 当前上下文 */
	private Context mContext;
	
	/** 时间集合*/
	private List<String> mValues;

	/**
	 * 构造方法
	 * @param context 当前上下文
	 */
	public MedicalReportTimeAdapter(Context context){
		mContext = context;
		mValues = new ArrayList<String>();
	}

	public void setData(List<String> values){
		mValues = values;
	}
	
	@Override
	public int getCount() {
		return mValues.size();
	}

	@Override
	public Object getItem(int position) {
		return mValues.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		if (convertView == null) {
			convertView = new MedicalReportTimeView(mContext);
		}
		
		((MedicalReportTimeView) convertView).updateView(mValues.get(position));
		
		return convertView;
	}

}
